import http from "@/api";
import { IMenuItem } from "@/api/interface/auth";

// * 获取全部菜单列表
export const getAuthMenuList = () => {
	return http.get<Menu.MenuOptions[]>({
		url: `/menu`
	});
};

// * 创建菜单
export const createMenu = (menuItem: IMenuItem) => {
	return http.post({
		url: `/menu`,
		data: menuItem
	});
};

// * 更新菜单
export const updateMenu = (menuItem: Menu.MenuOptions) => {
	return http.patch({
		url: `/menu/${menuItem.id}`,
		data: menuItem
	});
};

// * 删除菜单
export const deleteMenu = (id: number) => {
	return http.delete({
		url: `/menu/${id}`
	});
};
